<?php
use yii\helpers\Html;
use common\components\helpers\Fun;
use doumiaoduo\layer\LayerConfirmWidget;
use doumiaoduo\layer\LayerIframeWidget;
use common\components\extenders\MenuManage;
use common\components\widgets\Datetimepicker;
Datetimepicker::widget(['format'=>'Y-m-d',]);
LayerConfirmWidget::widget();
LayerIframeWidget::widget();
?>
<div class="yx-praise-list-box yx-praise-box yx-radius2 zx-min-height" id="toolbar" data-shelve_url="">
    <div id="search-area" class="yx-bgf7f7f7 yx-radius5 zx-mg yx-function2 yx-pr0">
        <?= Html::beginForm(Fun::url(['mechanicsubsidy/details','id'=>\Yii::$app->request->get('id')]), 'get', ['enctype' => 'multipart/form-data']) ?>
        <<?= \common\components\helpers\Search::textInput('start_time', $start, ['label'=>'开始时间','class'=>'datetimepicker yx-width150 zx-lh24 yx-ml6']); ?>
        <?= \common\components\helpers\Search::textInput('end_time', $end, ['label'=>'结束时间','class'=>'datetimepicker yx-width150 zx-lh24 yx-ml6']); ?>
        <?=\common\components\helpers\Search::dropDownList('mechanic_id',\Yii::$app->request->get('mechanic_id'),$mechanicList,['label'=>'选择机构','promote'=>'请选择','class'=>'search diy_select_txt'])?>
        <?=\common\components\helpers\Search::dropDownList('status_id',\Yii::$app->request->get('status_id'),[0=>'未结算',1=>'已结算'],['label'=>'选择状态','promote'=>'请选择','class'=>'search diy_select_txt'])?>
        <?= Html::submitButton('搜索', ['id'=>'search-handle','class'=>"yx-search-new yx-radius2"]); ?>
        <?php Html::endForm() ?>
    </div>
    <div class="docs-main zx-mg">
        <table id="tablesaw" class="tablesaw table yx-table1 yx-table3 table-striped with-check"  >
            <thead>
            <tr class="yx-bgd2f6ec">
                <th><?=\Yii::t('zhtfrontend','机构');?></th>
                <th><?=\Yii::t('zhtfrontend','课程');?></th>
                <th><?=\Yii::t('zhtfrontend','补贴金额');?></th>
                <th><?=\Yii::t('zhtfrontend','课次');?></th>
                <th><?=\Yii::t('zhtfrontend','上课日期');?></th>
                <th><?=\Yii::t('zhtfrontend','上课人数');?></th>
                <th><?=\Yii::t('zhtfrontend','结算状态');?></th>
                <th><?=\Yii::t('zhtfrontend','结算类型');?></th>
                <th><?=\Yii::t('zhtfrontend','结算时间');?></th>
                <th><?=\Yii::t('zhtfrontend','操作');?></th>
            </tr>
            </thead>
            <?php if($data):?>
                <?php foreach($data as $item):?>
                    <tr data-id="<?=$item['id']?>">
                        <td><?=$item['mechanic_name']?></td>
                        <td><?=$item['goods_name']?></td>
                        <td><?=$item['amount']?></td>
                        <td><?=$item['lesson']?></td>
                        <td><?=$item['class_date']?></td>
                        <td><?=$item['people_number']?></td>
                        <td><?=$item['status_name']?></td>
                        <td><?=$item['type']?></td>
                        <td><?=$item['settlement_time']?></td>
                        <td>
                            <?php if($item['status'] == 0) { ?>
                            <?=(new MenuManage(MenuManage::TOP_MENU))->detailsMenu('mechanicsettlement','settlement',true,['rel'=>'','class' => 'btn yx-radius2 yx-d-card yx-bg94d5a2','data'=>['id'=>$item['id']]]);?>
                            <?php }else{?>
                                <button style="color:#ffffff;border: none;padding: 1px 12px;border-radius:2px" type="button" disabled>结算</button>
                            <?php } ?>
                        </td>
                    </tr>
                <?php endforeach?>
            <?php endif?>
        </table>
        <div style="text-align: right"><?= common\components\widgets\GoPager::widget(['pagination' => $pages]) ?></div>
    </div>
</div>

<?php
$js = <<<JS
 layer.config({
        extend: ['skin/customskin/style.css']//加载您的扩展样式
    });
  $(document).on('click','.shows',function(){
    $(this).parents('tr').next().show();
    $(this).attr('class','nones').html('-');
  });
$(document).on('click','.nones',function(){
    $(this).parents('tr').next().hide();
    $(this).attr('class','shows').html('+');
  });

  $(document).on('click','.shelve',function(){
      var _this = $(this);
      var tr = _this.parents('tr');
      var td = _this.parent();
      var id = tr.data('id');
      $.post($('#toolbar').data('shelve_url'), {id:id,type:'skill'},function(data){
          if(data.status == 0){
              layer.msg(data.content,{id:'layer-msg',skin: 'layui-msg-customskin',time: 1000});
            return false;
          }else {
              
          }
          
      });
  });
JS;
$this->registerJS($js);
?>


